package olga.gorbatiuk.perdep.entity;

import java.io.Serializable;
import java.util.List;
import java.util.Objects;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author Olga Gorbatiuk
 */
@XmlRootElement
public class Position implements Serializable {

    private static final long serialVersionUID = 1L;
    private Integer positionId;
    private String name;
    private List<Employee> employeeList;

    public Position(Integer positionId, String name) {
        this.positionId = positionId;
        this.name = name;
    }

    public Integer getPositionId() {
        return positionId;
    }

    public void setPositionId(Integer positionId) {
        this.positionId = positionId;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    @XmlTransient
    public List<Employee> getEmployeeList() {
        return employeeList;
    }

    public void setEmployeeList(List<Employee> employeeList) {
        this.employeeList = employeeList;
    }

    @Override
    public final int hashCode() {
        return Objects.hashCode(this.name);
    }

    @Override
    public final boolean equals(Object object) {
        if (this == object) {
            return true;
        }
        if (!(object instanceof Position)) {
            return false;
        }
        final Position other = (Position) object;
        return Objects.equals(this.name, other.name);
    }

    @Override
    public String toString() {
        return "olga.gorbatiuk.perdep.entity.Position[ positionId=" + positionId + " ]";
    }

}
